<template>
  <div class="whiteBox blackBox container-fluid ">
    <div class="row justify-content-center title">
      <div class="col-9">
        <p>{{head}}</p>
      </div>
    </div>
    <div class="row justify-content-center title">
      <div class="col-9">
        <div class="nav row justify-content-around" ref="nav">
          <div :class="['col-3',item.id==index?'textTrue':'']" @click="change($event,item.id)" v-for="item in result.nav" :key="item.id">{{item.navName}}</div>
        </div>
        <div class="info row justify-content-around">
          <div class="col-md-4 col-10 text">
            <p>{{cardInfo.title}}</p>
            <p>
              {{cardInfo.info}}
            </p>
          </div>
          <div class="col-md-6 col-10 imgBox">
            <img :src="cardInfo.imgUrl" alt="">
          </div>
        </div>
      </div>
    </div>

  </div>
</template>


<script>
export default {
  data() {
    return {
      "head": "我们的优势",
      "index": 0,
      "cardInfo": {
        "title": "无",
        "info": "无",
        "imgUrl": "",
      },
      "result": {
        "nav": [
          { "id": 0, "navName": "系统开发" },
          { "id": 1, "navName": "专业团队" },
          { "id": 2, "navName": "评估&承诺" },
        ],
        "info": [
          {
            "id": 0,
            "title": "基于优秀、成熟系统开发",
            "info": "电商标准功能直接授权使用，成熟、稳定；除去电商标准功能外的功能再收定制费用，极大降低开发成本； 基于组件式的架构，松耦合式的开发，提高开发效率。",
            "imgUrl": "https://lanhu.oss-cn-beijing.aliyuncs.com/ps548603e1a9720d43-d0e1-42f8-af9c-07a37e365174",
            "f_id": 0
          },
          {
            "id": 1,
            "title": "非常棒的doing喜哦",
            "info": "电商标准功能直接授权使用，成熟、稳定；除去电商标准功能外的功能再收定制费用，极大降低开发成本； 基于组件式的架构，松耦合式的开发，提高开发效率。",
            "imgUrl": "https://lanhu.oss-cn-beijing.aliyuncs.com/ps548603e1a9720d43-d0e1-42f8-af9c-07a37e365174",
            "f_id": 1
          },
          {
            "id": 2,
            "title": "牛逼plus",
            "info": "电商标准功能直接授权使用，成熟、稳定；除去电商标准功能外的功能再收定制费用，极大降低开发成本； 基于组件式的架构，松耦合式的开发，提高开发效率。",
            "imgUrl": "https://lanhu.oss-cn-beijing.aliyuncs.com/ps548603e1a9720d43-d0e1-42f8-af9c-07a37e365174",
            "f_id": 2
          }
        ]
      }
    }
  },
  mounted() {
    this.result.info.forEach(element => {
      if (element.f_id == this.index) {
        this.cardInfo.title = element.title
        this.cardInfo.info = element.info
        this.cardInfo.imgUrl = element.imgUrl
      }
    });
  },
  methods: {
    change(e, id) {
      this.index = id
      this.result.info.forEach(element => {
        if (element.f_id == id) {
          this.cardInfo.title = element.title
          this.cardInfo.info = element.info
          this.cardInfo.imgUrl = element.imgUrl
        }
      });
    }
  }
}
</script>


<style lang="less" scoped>
.whiteBox {
  padding: 7.44rem 0;
  .title {
    text-align: center;
    font-size: 3rem;
    font-family: PingFang SC;
    font-weight: 500;
    color: rgba(51, 51, 51, 1);
  }
  .itemBox {
    margin: 2rem 0;
    display: flex;
    // flex-direction: column;
    // justify-content: center;
    align-items: center;
    .Box {
      display: flex;
      flex-direction: column;
      align-items: center;
      p {
        text-align: center;
      }
      .title {
        font-size: 1.13rem;
        font-family: PingFang SC;
        font-weight: bold;
        color: rgba(51, 51, 51, 1);
      }
      .info {
        font-size: 1rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(102, 102, 102, 1);
      }
      .imgBox {
        width: 8.75rem;
        height: 8.75rem;
        border-radius: 50%;
        background-color: #5ccfda;
      }
    }
  }
  .info {
    .row {
      margin: 6rem 0;
      .Box {
        display: flex;
        flex-direction: column;
        align-items: center;
        .imgBox {
          width: 100%;
          text-align: center;
          img {
            width: 80%;
          }
        }
        p {
          margin: 1rem 0;
          padding: 0 0;
        }
        .title {
          font-size: 1.5rem;
          font-family: PingFang SC;
          font-weight: 400;
          color: rgba(51, 51, 51, 1);
        }
        .info {
          font-size: 1rem;
          font-family: PingFang SC;
          font-weight: 400;
          color: rgba(153, 153, 153, 1);
        }
      }
    }
  }
  .infoImg {
    margin: 5rem 0;
    .infoBox {
      display: flex;
      flex-direction: column;
      align-items: center;
      // justify-content: center;
      .imgBox {
        width: 8.74rem;
        height: 8.74rem;
        line-height: 8.74rem;
        text-align: center;
        background-color: #5ccfda;
        border-radius: 50%;
        img {
          width: 50%;
          height: auto;
        }
      }
      p {
        text-align: center;
      }
      .title {
        margin-top: 1rem;
        font-size: 1.13rem;
        font-family: PingFang SC;
        font-weight: bold;
        color: rgba(51, 51, 51, 1);
      }
      .info {
        width: 80%;
        font-size: 1rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(102, 102, 102, 1);
      }
    }
    .seg {
      width: 100%;
      img {
        width: 100%;
        height: auto;
      }
    }
  }
}
.blackBox {
  background-color: #f7f7f7;
  .nav {
    cursor: pointer;
    margin: 3rem 0;
    div {
      padding: 1rem 1rem;
      font-size: 2rem;
      font-family: PingFang SC;
      font-weight: 500;
      color: rgba(51, 51, 51, 1);
    }
  }
  .info {
    padding: 3rem;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    .text {
      margin-top: 1rem;
      p {
        text-align: left;
      }
      p:nth-child(1) {
        font-size: 2rem;
        font-family: PingFang SC;
        font-weight: 500;
        color: rgba(51, 51, 51, 1);
      }
      p:nth-child(2) {
        font-size: 1.5rem;
        font-family: PingFang SC;
        font-weight: 400;
        color: rgba(102, 102, 102, 1);
      }
    }
    .imgBox {
      margin-top: 1rem;
      width: 100%;
      text-align: center;
      img {
        width: 80%;
      }
    }
  }
}
.textTrue {
  color: #5ccfda !important;
  border-bottom: 0.5rem solid #5ccfda;
}
</style>